﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZOVNP.Model.Abstracts;

namespace ZOVNP.Engine
{
    /// <summary> Менеджер получения данных. </summary>
    internal class ContextGetter : IContextGetter
    {

        #region Поля

        private ZOVNPContext _entities;

        #endregion

        #region Конструкторы

        public ContextGetter(ZOVNPContext entities)
        {
            _entities = entities;
        }

        #endregion

        #region Методы

        public IEnumerable<IOrderPartHelp> GetAllOrderPartHelps()
        {
            return _entities.Query<IOrderPartHelp>();
        }
        
        public IEnumerable<IPriceItem> GetAllPriceItemsFull()
        {
            return _entities.Query<IPriceItem>().Include(pi => pi.Material).Include(pi => pi.Product).ToArray();
        }

        #endregion

    }
}
